import { deleted, get, post } from '../utils/http/request'
import type { DataType } from '../page/users/interface'

interface LoginUser {
  username: string
  password: string
}

export const login = (data: LoginUser) => {
  return post('/login', data)
}

export const getMenu = () => {
  return get('/menu')
}

export const getUserList = (data: {
  companyName?: string
  contact?: string
  phone?: string
  pageNumber: number
  pageSize: number
}) => {
  return post('/userList', data)
}

export const deleteById = (id: number) => {
  return deleted(`/deleteById/${id}`)
}

export const deleteBatchById = (ids: React.Key[]) => {
  return deleted(`/deleteById/${ids}`)
}

export const editUserData = (userData: DataType) => {
  return post(`/editUserData/`, userData)
}
